Microsoft Cognitive Language Service - Question Answering (preview:2025-05-15)

2025/05/05 • 2 new methods

QuestionAnswering_GetAnswers (new)
Description Answers the specified question using your knowledge base.
Reference Link ¶

⚼ Request

POST:  /:query-knowledgebases
{
api-version: string ,
projectName: string ,
deploymentName: string ,
knowledgeBaseQueryOptions:
{
qnaId: integer ,
question: string ,
top: integer ,
userId: string ,
confidenceScoreThreshold: number ,
context:
{
previousQnaId: integer ,
previousUserQuery: string ,
}
,
rankerType: enum ,
filters:
{
metadataFilter:
{
metadata:
[
{
key: string ,
value: string ,
}
,
]
,
logicalOperation: enum ,
}
,
sourceFilter:
[
string ,
]
,
logicalOperation: enum ,
}
,
answerSpanRequest:
{
enable: boolean ,
confidenceScoreThreshold: number ,
topAnswersWithSpan: integer ,
}
,
includeUnstructuredSources: boolean ,
queryPreferences:
{
scorer: enum ,
matchingPolicy:
{
kind: enum ,
}
,
}
,
}
,
}

⚐ Response (200)

{
answers:
[
{
questions:
[
string ,
]
,
answer: string ,
confidenceScore: number ,
id: integer ,
source: string ,
metadata: object ,
dialog:
{
isContextOnly: boolean ,
prompts:
[
{
displayOrder: integer ,
qnaId: integer ,
displayText: string ,
}
,
]
,
}
,
answerSpan:
{
text: string ,
confidenceScore: number ,
offset: integer ,
length: integer ,
}
,
}
,
]
,
}

⚐ Response (default)

{
$headers:
{
x-ms-error-code: string ,
}
,
$schema:
{
error:
{
code: enum ,
message: string ,
target: string ,
details:
[
string ,
]
,
innererror:
{
code: enum ,
message: string ,
details: object ,
target: string ,
innererror: string ,
}
,
}
,
}
,
}
QuestionAnswering_GetAnswersFromText (new)
Description Answers the specified question using the provided text in the body.
Reference Link ¶

⚼ Request

POST:  /:query-text
{
api-version: string ,
textQueryOptions:
{
question: string ,
records:
[
{
id: string ,
text: string ,
}
,
]
,
language: string ,
stringIndexType: enum ,
}
,
}

⚐ Response (200)

{
answers:
[
{
answer: string ,
confidenceScore: number ,
id: string ,
answerSpan:
{
text: string ,
confidenceScore: number ,
offset: integer ,
length: integer ,
}
,
offset: integer ,
length: integer ,
}
,
]
,
}

⚐ Response (default)

{
$headers:
{
x-ms-error-code: string ,
}
,
$schema:
{
error:
{
code: enum ,
message: string ,
target: string ,
details:
[
string ,
]
,
innererror:
{
code: enum ,
message: string ,
details: object ,
target: string ,
innererror: string ,
}
,
}
,
}
,
}